<template>
	<view class=" round-8 overflow-hidden h-250  relative text-white ">
		<view class="w-p-100 flex flex-center h-p-100 flex-column gap-8 bg-white"  v-if="props.detail.status==1">
			<y-loading></y-loading>
			<text class="fs-12 text-666">创建中...</text>
		</view>
		<image v-if="props.detail.status==3" src="/static/image/loading.png" class="round-8 w-p-100 h-p-100"></image>
		<image v-if="props.detail.status==2" :src="props.detail.cover" class="round-8 w-p-100 h-p-100"
			@click="openPopup(props.detail)"></image>
		<view class="absolute bottom-0 left-0 right-0 px-10 py-6 bg">
			<view class="flex flex-x-space-between flex-y-center">
				<text class="fs-15">{{props.detail.title}}</text>
				<text class="iconfont icon-gengduo text-white" @click="morePopup.open()"></text>
			</view>
			<text class="fs-12">{{props.detail.create_time}}</text>
		</view>
	</view>

	<y-popup ref="morePopup" mode="bottom" round='16px'>
		<view class='text-center fs-15 round-top-10 '>
			<view class="wa  py-15 border-bottom-f1 " @click="rename">重命名</view>
			<view class="wa  py-15 border-bottom-f1 text-red " @click="del">删除</view>
		</view>
	</y-popup>
	<y-more ref="morePopup" :type='props.type' :id="props.detail.id" @success="emit('success')"></y-more>

</template>

<script setup>
	import { ref } from 'vue';
	import { $tool } from "@/utils";
	import { editWorksName, delWorks } from '@/api/works.js'
	import { editSceneName, delScene } from '@/api/scene.js'
	const emit = defineEmits(['success', 'clickCenter'])

	const props = defineProps({
		// 1 视频  2分身
		type: {
			type: [String, Number],
			default: 1
		},
		detail: {
			type: [Object, String],
			default: []
		}
	})
	const morePopup = ref()
	const openPopup = (e) => {
		emit('clickCenter', e)
	}
</script>

<style>
	.bg {
		background: rgba(0, 0, 0, 0.5);
		backdrop-filter: blur(10px);
	}
</style>